Change in openvpn[master]: Rename state_change to continue_tls_process
A message that is not in the archive (sent off-list or not yet received): gerrit.1700485351000.Ib6d713f2eb08a4c39d97de3e1a4a832cedc09585@...2715...
Attention is currently required from: flichtenheld.
Hello flichtenheld,
I'd like you to do a code review.
Please visit
http://gerrit.openvpn.net/c/openvpn/+/452?usp=email
to review the following change.
Change subject: Rename state_change to continue_tls_process
......................................................................
Rename state_change to continue_tls_process
The name state_change is more confusing than helpful as it not really indicates if there was a state change but rather if processing should be continued. There even some states that are definitively state changes (setting to_link buffer) that require continue_tls_process to be set to false.
Change-Id: Ib6d713f2eb08a4c39d97de3e1a4a832cedc09585
---
M src/openvpn/ssl.c
1 file changed, 21 insertions(+), 15 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/52/452/1
src/openvpn/ssl.c +21 -15
@@ -2848,13 +2848,19 @@ struct link_socket_info *to_link_socket_info, interval_t *wakeup) { - bool state_change = false; +/* This variable indicates if we should call this method +* again to process more incoming/outgoing TLS state/data +* We want to repeat this until we either determined that there +* is nothing more to process or that further processing +* should only be done after the outer loop (sending packets etc.) +* has run once more */ +bool continue_tls_process = false;struct key_state *ks = &session->key[KS_PRIMARY ];/* primary key */ /* Initial handshake */ if (ks->state ==S_INITIAL ) { - state_change =session_move_pre_start (session, ks, false); + continue_tls_process =session_move_pre_start (session, ks, false); }/* Are we timed out on receive? */
@@ -2872,7 +2878,7 @@if (ks->state ==S_PRE_START &&reliable_empty (ks->send_reliable)) { ks->state =S_START ; - state_change = true; + continue_tls_process = true;/* New connection, remove any old X509 env variables */ tls_x509_clear_env (session->opt->es);
@@ -2885,7 +2891,7 @@ && reliable_empty(ks->send_reliable)) {session_move_active (multi, session, to_link_socket_info, ks); - state_change = true; + continue_tls_process = true; }/* Reliable buffer to outgoing TCP/UDP (send up to CONTROL_SEND_ACK_MAX ACKs
@@ -2927,7 +2933,7 @@ }else { -if (!read_incoming_tls_ciphertext (&entry->buf, ks, &state_change)) +if (!read_incoming_tls_ciphertext (&entry->buf, ks, &continue_tls_process)) { goto error; }
@@ -2938,7 +2944,7 @@struct buffer *buf = &ks->plaintext_read_buf;if (!buf->len) { -if (!read_incoming_tls_plaintext (ks, buf, wakeup, &state_change)) +if (!read_incoming_tls_plaintext (ks, buf, wakeup, &continue_tls_process)) { goto error; }
@@ -2954,7 +2960,7 @@ goto error; } - state_change = true; + continue_tls_process = true;dmsg (D_TLS_DEBUG_MED ,"STATE S_SENT_KEY" ); ks->state =S_SENT_KEY ; }
@@ -2970,7 +2976,7 @@ goto error; } - state_change = true; + continue_tls_process = true;dmsg (D_TLS_DEBUG_MED ,"STATE S_GOT_KEY" ); ks->state =S_GOT_KEY ; }
@@ -2988,7 +2994,7 @@ }if (status ==1 ) { - state_change = true; + continue_tls_process = true;dmsg (D_TLS_DEBUG ,"Outgoing Plaintext -> TLS" ); } }
@@ -3006,7 +3012,7 @@ } } -return state_change; +return continue_tls_process; error:tls_clear_error (); ks->state =S_ERROR ;
@@ -3065,19 +3071,19 @@msg (D_TLS_DEBUG_LOW ,"TLS: tls_process: killed expiring key" ); } -bool state_change = true; -while (state_change) +bool continue_tls_process = true; +while (continue_tls_process) {update_time ();dmsg (D_TLS_DEBUG ,"TLS: tls_process: chg=%d ks=%s lame=%s to_link->len=%d wakeup=%d" , - state_change, + continue_tls_process,state_name (ks->state),state_name (ks_lame->state), to_link->len, *wakeup); - state_change =tls_process_state (multi, session, to_link, to_link_addr, - to_link_socket_info, wakeup); + continue_tls_process =tls_process_state (multi, session, to_link, to_link_addr, + to_link_socket_info, wakeup);if (ks->state ==S_ERROR ) {
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/452?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ib6d713f2eb08a4c39d97de3e1a4a832cedc09585
Gerrit-Change-Number: 452
Gerrit-PatchSet: 1
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-MessageType: newchange
Attention is currently required from: plaisthos.
flichtenheld has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/452?usp=email )
Change subject: Rename state_change to continue_tls_process
......................................................................
Patch Set 1: Code-Review-1
(3 comments)
Patchset:
PS1:
Good change, but should recurse
File src/openvpn/ssl.c:
http://gerrit.openvpn.net/c/openvpn/+/452/comment/bdfcf50c_c5c3ee11 :
PS1, Line 2936: if (!read_incoming_tls_ciphertext(&entry->buf, ks, &continue_tls_process))
Should rename argument of read_incoming_tls_ciphertext as well
http://gerrit.openvpn.net/c/openvpn/+/452/comment/2662067f_27eb71a1 :
PS1, Line 2947: if (!read_incoming_tls_plaintext(ks, buf, wakeup, &continue_tls_process))
Should rename argument of read_incoming_tls_plaintext as well
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/452?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ib6d713f2eb08a4c39d97de3e1a4a832cedc09585
Gerrit-Change-Number: 452
Gerrit-PatchSet: 1
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Comment-Date: Mon, 20 Nov 2023 13:12:13 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
Attention is currently required from: flichtenheld, plaisthos.
Hello flichtenheld,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/452?usp=email
to look at the new patch set (#2).
The following approvals got outdated and were removed:
Code-Review-1 by flichtenheld
Change subject: Rename state_change to continue_tls_process
......................................................................
Rename state_change to continue_tls_process
The name state_change is more confusing than helpful as it not really indicates if there was a state change but rather if processing should be continued. There even some states that are definitively state changes (setting to_link buffer) that require continue_tls_process to be set to false.
Change-Id: Ib6d713f2eb08a4c39d97de3e1a4a832cedc09585
---
M src/openvpn/ssl.c
1 file changed, 27 insertions(+), 22 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/52/452/2
src/openvpn/ssl.c +27 -22
@@ -2694,7 +2694,7 @@*/ static bool read_incoming_tls_ciphertext (struct buffer *buf,struct key_state *ks, -bool *state_change) +bool *continue_tls_process) {int status =0 ;if (buf->len)
@@ -2714,7 +2714,7 @@if (status ==1 ) {reliable_mark_deleted (ks->rec_reliable, buf); - *state_change = true; + *continue_tls_process = true;dmsg (D_TLS_DEBUG ,"Incoming Ciphertext -> TLS" ); }return true;
@@ -2730,7 +2730,7 @@static bool read_incoming_tls_plaintext (struct key_state *ks,struct buffer *buf, -interval_t *wakeup,bool *state_change) +interval_t *wakeup,bool *continue_tls_process) {ASSERT (buf_init (buf,0 ));
@@ -2744,7 +2744,7 @@ }if (status ==1 ) { - *state_change = true; + *continue_tls_process = true;dmsg (D_TLS_DEBUG ,"TLS -> Incoming Plaintext" );/* More data may be available, wake up again asap to check. */
@@ -2754,7 +2754,7 @@ }static bool -write_outgoing_tls_ciphertext (struct tls_session *session,bool *state_change) +write_outgoing_tls_ciphertext (struct tls_session *session,bool *continue_tls_process) {struct key_state *ks = &session->key[KS_PRIMARY ];
@@ -2830,7 +2830,7 @@reliable_mark_active_outgoing (ks->send_reliable, buf, opcode);INCR_GENERATED ; - *state_change = true; + *continue_tls_process = true; }dmsg (D_TLS_DEBUG ,"Outgoing Ciphertext -> Reliable" ); }
@@ -2839,7 +2839,6 @@return true; } - static bool tls_process_state(struct tls_multi *multi, struct tls_session *session,
@@ -2848,13 +2847,19 @@ struct link_socket_info *to_link_socket_info, interval_t *wakeup) { - bool state_change = false; +/* This variable indicates if we should call this method +* again to process more incoming/outgoing TLS state/data +* We want to repeat this until we either determined that there +* is nothing more to process or that further processing +* should only be done after the outer loop (sending packets etc.) +* has run once more */ +bool continue_tls_process = false;struct key_state *ks = &session->key[KS_PRIMARY ];/* primary key */ /* Initial handshake */ if (ks->state ==S_INITIAL ) { - state_change =session_move_pre_start (session, ks, false); + continue_tls_process =session_move_pre_start (session, ks, false); }/* Are we timed out on receive? */
@@ -2872,7 +2877,7 @@if (ks->state ==S_PRE_START &&reliable_empty (ks->send_reliable)) { ks->state =S_START ; - state_change = true; + continue_tls_process = true;/* New connection, remove any old X509 env variables */ tls_x509_clear_env (session->opt->es);
@@ -2885,7 +2890,7 @@ && reliable_empty(ks->send_reliable)) {session_move_active (multi, session, to_link_socket_info, ks); - state_change = true; + continue_tls_process = true; }/* Reliable buffer to outgoing TCP/UDP (send up to CONTROL_SEND_ACK_MAX ACKs
@@ -2927,7 +2932,7 @@ }else { -if (!read_incoming_tls_ciphertext (&entry->buf, ks, &state_change)) +if (!read_incoming_tls_ciphertext (&entry->buf, ks, &continue_tls_process)) { goto error; }
@@ -2938,7 +2943,7 @@struct buffer *buf = &ks->plaintext_read_buf;if (!buf->len) { -if (!read_incoming_tls_plaintext (ks, buf, wakeup, &state_change)) +if (!read_incoming_tls_plaintext (ks, buf, wakeup, &continue_tls_process)) { goto error; }
@@ -2954,7 +2959,7 @@ goto error; } - state_change = true; + continue_tls_process = true;dmsg (D_TLS_DEBUG_MED ,"STATE S_SENT_KEY" ); ks->state =S_SENT_KEY ; }
@@ -2970,7 +2975,7 @@ goto error; } - state_change = true; + continue_tls_process = true;dmsg (D_TLS_DEBUG_MED ,"STATE S_GOT_KEY" ); ks->state =S_GOT_KEY ; }
@@ -2988,7 +2993,7 @@ }if (status ==1 ) { - state_change = true; + continue_tls_process = true;dmsg (D_TLS_DEBUG ,"Outgoing Plaintext -> TLS" ); } }
@@ -3006,7 +3011,7 @@ } } -return state_change; +return continue_tls_process; error:tls_clear_error (); ks->state =S_ERROR ;
@@ -3065,19 +3070,19 @@msg (D_TLS_DEBUG_LOW ,"TLS: tls_process: killed expiring key" ); } -bool state_change = true; -while (state_change) +bool continue_tls_process = true; +while (continue_tls_process) {update_time ();dmsg (D_TLS_DEBUG ,"TLS: tls_process: chg=%d ks=%s lame=%s to_link->len=%d wakeup=%d" , - state_change, + continue_tls_process,state_name (ks->state),state_name (ks_lame->state), to_link->len, *wakeup); - state_change =tls_process_state (multi, session, to_link, to_link_addr, - to_link_socket_info, wakeup); + continue_tls_process =tls_process_state (multi, session, to_link, to_link_addr, + to_link_socket_info, wakeup);if (ks->state ==S_ERROR ) {
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/452?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ib6d713f2eb08a4c39d97de3e1a4a832cedc09585
Gerrit-Change-Number: 452
Gerrit-PatchSet: 2
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-MessageType: newpatchset
Attention is currently required from: plaisthos.
flichtenheld has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/452?usp=email )
Change subject: Rename state_change to continue_tls_process
......................................................................
Patch Set 2: Code-Review-2
(1 comment)
File src/openvpn/ssl.c:
http://gerrit.openvpn.net/c/openvpn/+/452/comment/17cb7023_b42d55a5 :
PS2, Line 3007: if (!write_outgoing_tls_ciphertext(session, &state_change))
Still says state_change, breaking the build
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/452?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ib6d713f2eb08a4c39d97de3e1a4a832cedc09585
Gerrit-Change-Number: 452
Gerrit-PatchSet: 2
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Comment-Date: Mon, 20 Nov 2023 14:54:58 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
Attention is currently required from: plaisthos.
Hello flichtenheld,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/452?usp=email
to look at the new patch set (#3).
Change subject: Rename state_change to continue_tls_process
......................................................................
Rename state_change to continue_tls_process
The name state_change is more confusing than helpful as it not really indicates if there was a state change but rather if processing should be continued. There even some states that are definitively state changes (setting to_link buffer) that require continue_tls_process to be set to false.
Change-Id: Ib6d713f2eb08a4c39d97de3e1a4a832cedc09585
---
M src/openvpn/ssl.c
1 file changed, 28 insertions(+), 23 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/52/452/3
src/openvpn/ssl.c +28 -23
@@ -2694,7 +2694,7 @@*/ static bool read_incoming_tls_ciphertext (struct buffer *buf,struct key_state *ks, -bool *state_change) +bool *continue_tls_process) {int status =0 ;if (buf->len)
@@ -2714,7 +2714,7 @@if (status ==1 ) {reliable_mark_deleted (ks->rec_reliable, buf); - *state_change = true; + *continue_tls_process = true;dmsg (D_TLS_DEBUG ,"Incoming Ciphertext -> TLS" ); }return true;
@@ -2730,7 +2730,7 @@static bool read_incoming_tls_plaintext (struct key_state *ks,struct buffer *buf, -interval_t *wakeup,bool *state_change) +interval_t *wakeup,bool *continue_tls_process) {ASSERT (buf_init (buf,0 ));
@@ -2744,7 +2744,7 @@ }if (status ==1 ) { - *state_change = true; + *continue_tls_process = true;dmsg (D_TLS_DEBUG ,"TLS -> Incoming Plaintext" );/* More data may be available, wake up again asap to check. */
@@ -2754,7 +2754,7 @@ }static bool -write_outgoing_tls_ciphertext (struct tls_session *session,bool *state_change) +write_outgoing_tls_ciphertext (struct tls_session *session,bool *continue_tls_process) {struct key_state *ks = &session->key[KS_PRIMARY ];
@@ -2830,7 +2830,7 @@reliable_mark_active_outgoing (ks->send_reliable, buf, opcode);INCR_GENERATED ; - *state_change = true; + *continue_tls_process = true; }dmsg (D_TLS_DEBUG ,"Outgoing Ciphertext -> Reliable" ); }
@@ -2839,7 +2839,6 @@return true; } - static bool tls_process_state(struct tls_multi *multi, struct tls_session *session,
@@ -2848,13 +2847,19 @@ struct link_socket_info *to_link_socket_info, interval_t *wakeup) { - bool state_change = false; +/* This variable indicates if we should call this method +* again to process more incoming/outgoing TLS state/data +* We want to repeat this until we either determined that there +* is nothing more to process or that further processing +* should only be done after the outer loop (sending packets etc.) +* has run once more */ +bool continue_tls_process = false;struct key_state *ks = &session->key[KS_PRIMARY ];/* primary key */ /* Initial handshake */ if (ks->state ==S_INITIAL ) { - state_change =session_move_pre_start (session, ks, false); + continue_tls_process =session_move_pre_start (session, ks, false); }/* Are we timed out on receive? */
@@ -2872,7 +2877,7 @@if (ks->state ==S_PRE_START &&reliable_empty (ks->send_reliable)) { ks->state =S_START ; - state_change = true; + continue_tls_process = true;/* New connection, remove any old X509 env variables */ tls_x509_clear_env (session->opt->es);
@@ -2885,7 +2890,7 @@ && reliable_empty(ks->send_reliable)) {session_move_active (multi, session, to_link_socket_info, ks); - state_change = true; + continue_tls_process = true; }/* Reliable buffer to outgoing TCP/UDP (send up to CONTROL_SEND_ACK_MAX ACKs
@@ -2927,7 +2932,7 @@ }else { -if (!read_incoming_tls_ciphertext (&entry->buf, ks, &state_change)) +if (!read_incoming_tls_ciphertext (&entry->buf, ks, &continue_tls_process)) { goto error; }
@@ -2938,7 +2943,7 @@struct buffer *buf = &ks->plaintext_read_buf;if (!buf->len) { -if (!read_incoming_tls_plaintext (ks, buf, wakeup, &state_change)) +if (!read_incoming_tls_plaintext (ks, buf, wakeup, &continue_tls_process)) { goto error; }
@@ -2954,7 +2959,7 @@ goto error; } - state_change = true; + continue_tls_process = true;dmsg (D_TLS_DEBUG_MED ,"STATE S_SENT_KEY" ); ks->state =S_SENT_KEY ; }
@@ -2970,7 +2975,7 @@ goto error; } - state_change = true; + continue_tls_process = true;dmsg (D_TLS_DEBUG_MED ,"STATE S_GOT_KEY" ); ks->state =S_GOT_KEY ; }
@@ -2988,7 +2993,7 @@ }if (status ==1 ) { - state_change = true; + continue_tls_process = true;dmsg (D_TLS_DEBUG ,"Outgoing Plaintext -> TLS" ); } }
@@ -2999,14 +3004,14 @@ buf =reliable_get_buf_output_sequenced (ks->send_reliable);if (buf) { -if (!write_outgoing_tls_ciphertext (session, &state_change)) +if (!write_outgoing_tls_ciphertext (session, &continue_tls_process)) { goto error; } } } -return state_change; +return continue_tls_process; error:tls_clear_error (); ks->state =S_ERROR ;
@@ -3065,19 +3070,19 @@msg (D_TLS_DEBUG_LOW ,"TLS: tls_process: killed expiring key" ); } -bool state_change = true; -while (state_change) +bool continue_tls_process = true; +while (continue_tls_process) {update_time ();dmsg (D_TLS_DEBUG ,"TLS: tls_process: chg=%d ks=%s lame=%s to_link->len=%d wakeup=%d" , - state_change, + continue_tls_process,state_name (ks->state),state_name (ks_lame->state), to_link->len, *wakeup); - state_change =tls_process_state (multi, session, to_link, to_link_addr, - to_link_socket_info, wakeup); + continue_tls_process =tls_process_state (multi, session, to_link, to_link_addr, + to_link_socket_info, wakeup);if (ks->state ==S_ERROR ) {
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/452?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ib6d713f2eb08a4c39d97de3e1a4a832cedc09585
Gerrit-Change-Number: 452
Gerrit-PatchSet: 3
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-MessageType: newpatchset
Attention is currently required from: flichtenheld.
plaisthos has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/452?usp=email )
Change subject: Rename state_change to continue_tls_process
......................................................................
Patch Set 3:
(3 comments)
File src/openvpn/ssl.c:
http://gerrit.openvpn.net/c/openvpn/+/452/comment/4493eb6f_5624d2ca :
PS1, Line 2936: if (!read_incoming_tls_ciphertext(&entry->buf, ks, &continue_tls_process))
Quoted 1 line
Should rename argument of
read_incoming_tls_ciphertextas well
Done
http://gerrit.openvpn.net/c/openvpn/+/452/comment/1e69d0fc_7323711d :
PS1, Line 2947: if (!read_incoming_tls_plaintext(ks, buf, wakeup, &continue_tls_process))
Quoted 1 line
Should rename argument of
read_incoming_tls_plaintextas well
Done
File src/openvpn/ssl.c:
http://gerrit.openvpn.net/c/openvpn/+/452/comment/c4c12c6f_b4fe17bb :
PS2, Line 3007: if (!write_outgoing_tls_ciphertext(session, &state_change))
Quoted 1 line
Still says
state_change, breaking the build
That is what you get for only testing the whole patch set and not each commit.
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/452?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ib6d713f2eb08a4c39d97de3e1a4a832cedc09585
Gerrit-Change-Number: 452
Gerrit-PatchSet: 3
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Mon, 20 Nov 2023 17:15:44 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: flichtenheld <[email protected]...>
Gerrit-MessageType: comment
Attention is currently required from: plaisthos.
flichtenheld has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/452?usp=email )
Change subject: Rename state_change to continue_tls_process
......................................................................
Patch Set 3: Code-Review+2
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/452?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ib6d713f2eb08a4c39d97de3e1a4a832cedc09585
Gerrit-Change-Number: 452
Gerrit-PatchSet: 3
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Comment-Date: Tue, 21 Nov 2023 14:41:04 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
PATCH v3 1/1 Rename state_change to continue_tls_process
In reply to a message not in the archiveFrom: Arne Schwabe <[email protected]...>
The name state_change is more confusing than helpful as it not really indicates if there was a state change but rather if processing should be continued. There even some states that are definitively state changes (setting to_link buffer) that require continue_tls_process to be set to false.
---
This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/452
This mail reflects revision 3 of this Change. Acked-by according to Gerrit (reflected above):
Frank Lichtenheld <[email protected]...>
src/openvpn/ssl.c +28 -23
@@ -2694,7 +2694,7 @@*/ static bool read_incoming_tls_ciphertext (struct buffer *buf,struct key_state *ks, -bool *state_change) +bool *continue_tls_process) {int status =0 ;if (buf->len)
@@ -2714,7 +2714,7 @@if (status ==1 ) {reliable_mark_deleted (ks->rec_reliable, buf); - *state_change = true; + *continue_tls_process = true;dmsg (D_TLS_DEBUG ,"Incoming Ciphertext -> TLS" ); }return true;
@@ -2730,7 +2730,7 @@static bool read_incoming_tls_plaintext (struct key_state *ks,struct buffer *buf, -interval_t *wakeup,bool *state_change) +interval_t *wakeup,bool *continue_tls_process) {ASSERT (buf_init (buf,0 ));
@@ -2744,7 +2744,7 @@ }if (status ==1 ) { - *state_change = true; + *continue_tls_process = true;dmsg (D_TLS_DEBUG ,"TLS -> Incoming Plaintext" );/* More data may be available, wake up again asap to check. */
@@ -2754,7 +2754,7 @@ }static bool -write_outgoing_tls_ciphertext (struct tls_session *session,bool *state_change) +write_outgoing_tls_ciphertext (struct tls_session *session,bool *continue_tls_process) {struct key_state *ks = &session->key[KS_PRIMARY ];
@@ -2830,7 +2830,7 @@reliable_mark_active_outgoing (ks->send_reliable, buf, opcode);INCR_GENERATED ; - *state_change = true; + *continue_tls_process = true; }dmsg (D_TLS_DEBUG ,"Outgoing Ciphertext -> Reliable" ); }
@@ -2839,7 +2839,6 @@return true; } - static bool tls_process_state(struct tls_multi *multi, struct tls_session *session,
@@ -2848,13 +2847,19 @@ struct link_socket_info *to_link_socket_info, interval_t *wakeup) { - bool state_change = false; +/* This variable indicates if we should call this method +* again to process more incoming/outgoing TLS state/data +* We want to repeat this until we either determined that there +* is nothing more to process or that further processing +* should only be done after the outer loop (sending packets etc.) +* has run once more */ +bool continue_tls_process = false;struct key_state *ks = &session->key[KS_PRIMARY ];/* primary key */ /* Initial handshake */ if (ks->state ==S_INITIAL ) { - state_change =session_move_pre_start (session, ks, false); + continue_tls_process =session_move_pre_start (session, ks, false); }/* Are we timed out on receive? */
@@ -2872,7 +2877,7 @@if (ks->state ==S_PRE_START &&reliable_empty (ks->send_reliable)) { ks->state =S_START ; - state_change = true; + continue_tls_process = true;/* New connection, remove any old X509 env variables */ tls_x509_clear_env (session->opt->es);
@@ -2885,7 +2890,7 @@ && reliable_empty(ks->send_reliable)) {session_move_active (multi, session, to_link_socket_info, ks); - state_change = true; + continue_tls_process = true; }/* Reliable buffer to outgoing TCP/UDP (send up to CONTROL_SEND_ACK_MAX ACKs
@@ -2927,7 +2932,7 @@ }else { -if (!read_incoming_tls_ciphertext (&entry->buf, ks, &state_change)) +if (!read_incoming_tls_ciphertext (&entry->buf, ks, &continue_tls_process)) { goto error; }
@@ -2938,7 +2943,7 @@struct buffer *buf = &ks->plaintext_read_buf;if (!buf->len) { -if (!read_incoming_tls_plaintext (ks, buf, wakeup, &state_change)) +if (!read_incoming_tls_plaintext (ks, buf, wakeup, &continue_tls_process)) { goto error; }
@@ -2954,7 +2959,7 @@ goto error; } - state_change = true; + continue_tls_process = true;dmsg (D_TLS_DEBUG_MED ,"STATE S_SENT_KEY" ); ks->state =S_SENT_KEY ; }
@@ -2970,7 +2975,7 @@ goto error; } - state_change = true; + continue_tls_process = true;dmsg (D_TLS_DEBUG_MED ,"STATE S_GOT_KEY" ); ks->state =S_GOT_KEY ; }
@@ -2988,7 +2993,7 @@ }if (status ==1 ) { - state_change = true; + continue_tls_process = true;dmsg (D_TLS_DEBUG ,"Outgoing Plaintext -> TLS" ); } }
@@ -2999,14 +3004,14 @@ buf =reliable_get_buf_output_sequenced (ks->send_reliable);if (buf) { -if (!write_outgoing_tls_ciphertext (session, &state_change)) +if (!write_outgoing_tls_ciphertext (session, &continue_tls_process)) { goto error; } } } -return state_change; +return continue_tls_process; error:tls_clear_error (); ks->state =S_ERROR ;
@@ -3065,19 +3070,19 @@msg (D_TLS_DEBUG_LOW ,"TLS: tls_process: killed expiring key" ); } -bool state_change = true; -while (state_change) +bool continue_tls_process = true; +while (continue_tls_process) {update_time ();dmsg (D_TLS_DEBUG ,"TLS: tls_process: chg=%d ks=%s lame=%s to_link->len=%d wakeup=%d" , - state_change, + continue_tls_process,state_name (ks->state),state_name (ks_lame->state), to_link->len, *wakeup); - state_change =tls_process_state (multi, session, to_link, to_link_addr, - to_link_socket_info, wakeup); + continue_tls_process =tls_process_state (multi, session, to_link, to_link_addr, + to_link_socket_info, wakeup);if (ks->state ==S_ERROR ) {
[Openvpn-devel] [PATCH applied] Re: Rename state_change to continue_tls_process
This is really straightforward rename + added comments. Gave it a full test nonetheless :-)
One could argue that the debug print with "tls_process: chg=%d" could use an adjustment as well ("cont=%d"?).
Your patch has been applied to the master branch.
commit 8ba03f91388970754f3536866f9687759b07a63c (master)
Author: Arne Schwabe Date: Tue Nov 28 11:37:04 2023 +0100
Rename state_change to continue_tls_process
Acked-by: Frank Lichtenheld <[email protected]...>
Signed-off-by: Arne Schwabe <[email protected]...>
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg27571.html
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering
cron2 has uploaded a new patch set (#4) to the change originally created by plaisthos. ( http://gerrit.openvpn.net/c/openvpn/+/452?usp=email )
The following approvals got outdated and were removed:
Code-Review+2 by flichtenheld
Change subject: Rename state_change to continue_tls_process
......................................................................
Rename state_change to continue_tls_process
The name state_change is more confusing than helpful as it not really indicates if there was a state change but rather if processing should be continued. There even some states that are definitively state changes (setting to_link buffer) that require continue_tls_process to be set to false.
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg27571.html
---
M src/openvpn/ssl.c
1 file changed, 28 insertions(+), 23 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/52/452/4
src/openvpn/ssl.c +28 -23
@@ -2694,7 +2694,7 @@*/ static bool read_incoming_tls_ciphertext (struct buffer *buf,struct key_state *ks, -bool *state_change) +bool *continue_tls_process) {int status =0 ;if (buf->len)
@@ -2714,7 +2714,7 @@if (status ==1 ) {reliable_mark_deleted (ks->rec_reliable, buf); - *state_change = true; + *continue_tls_process = true;dmsg (D_TLS_DEBUG ,"Incoming Ciphertext -> TLS" ); }return true;
@@ -2730,7 +2730,7 @@static bool read_incoming_tls_plaintext (struct key_state *ks,struct buffer *buf, -interval_t *wakeup,bool *state_change) +interval_t *wakeup,bool *continue_tls_process) {ASSERT (buf_init (buf,0 ));
@@ -2744,7 +2744,7 @@ }if (status ==1 ) { - *state_change = true; + *continue_tls_process = true;dmsg (D_TLS_DEBUG ,"TLS -> Incoming Plaintext" );/* More data may be available, wake up again asap to check. */
@@ -2754,7 +2754,7 @@ }static bool -write_outgoing_tls_ciphertext (struct tls_session *session,bool *state_change) +write_outgoing_tls_ciphertext (struct tls_session *session,bool *continue_tls_process) {struct key_state *ks = &session->key[KS_PRIMARY ];
@@ -2830,7 +2830,7 @@reliable_mark_active_outgoing (ks->send_reliable, buf, opcode);INCR_GENERATED ; - *state_change = true; + *continue_tls_process = true; }dmsg (D_TLS_DEBUG ,"Outgoing Ciphertext -> Reliable" ); }
@@ -2839,7 +2839,6 @@return true; } - static bool tls_process_state(struct tls_multi *multi, struct tls_session *session,
@@ -2848,13 +2847,19 @@ struct link_socket_info *to_link_socket_info, interval_t *wakeup) { - bool state_change = false; +/* This variable indicates if we should call this method +* again to process more incoming/outgoing TLS state/data +* We want to repeat this until we either determined that there +* is nothing more to process or that further processing +* should only be done after the outer loop (sending packets etc.) +* has run once more */ +bool continue_tls_process = false;struct key_state *ks = &session->key[KS_PRIMARY ];/* primary key */ /* Initial handshake */ if (ks->state ==S_INITIAL ) { - state_change =session_move_pre_start (session, ks, false); + continue_tls_process =session_move_pre_start (session, ks, false); }/* Are we timed out on receive? */
@@ -2872,7 +2877,7 @@if (ks->state ==S_PRE_START &&reliable_empty (ks->send_reliable)) { ks->state =S_START ; - state_change = true; + continue_tls_process = true;/* New connection, remove any old X509 env variables */ tls_x509_clear_env (session->opt->es);
@@ -2885,7 +2890,7 @@ && reliable_empty(ks->send_reliable)) {session_move_active (multi, session, to_link_socket_info, ks); - state_change = true; + continue_tls_process = true; }/* Reliable buffer to outgoing TCP/UDP (send up to CONTROL_SEND_ACK_MAX ACKs
@@ -2927,7 +2932,7 @@ }else { -if (!read_incoming_tls_ciphertext (&entry->buf, ks, &state_change)) +if (!read_incoming_tls_ciphertext (&entry->buf, ks, &continue_tls_process)) { goto error; }
@@ -2938,7 +2943,7 @@struct buffer *buf = &ks->plaintext_read_buf;if (!buf->len) { -if (!read_incoming_tls_plaintext (ks, buf, wakeup, &state_change)) +if (!read_incoming_tls_plaintext (ks, buf, wakeup, &continue_tls_process)) { goto error; }
@@ -2954,7 +2959,7 @@ goto error; } - state_change = true; + continue_tls_process = true;dmsg (D_TLS_DEBUG_MED ,"STATE S_SENT_KEY" ); ks->state =S_SENT_KEY ; }
@@ -2970,7 +2975,7 @@ goto error; } - state_change = true; + continue_tls_process = true;dmsg (D_TLS_DEBUG_MED ,"STATE S_GOT_KEY" ); ks->state =S_GOT_KEY ; }
@@ -2988,7 +2993,7 @@ }if (status ==1 ) { - state_change = true; + continue_tls_process = true;dmsg (D_TLS_DEBUG ,"Outgoing Plaintext -> TLS" ); } }
@@ -2999,14 +3004,14 @@ buf =reliable_get_buf_output_sequenced (ks->send_reliable);if (buf) { -if (!write_outgoing_tls_ciphertext (session, &state_change)) +if (!write_outgoing_tls_ciphertext (session, &continue_tls_process)) { goto error; } } } -return state_change; +return continue_tls_process; error:tls_clear_error (); ks->state =S_ERROR ;
@@ -3065,19 +3070,19 @@msg (D_TLS_DEBUG_LOW ,"TLS: tls_process: killed expiring key" ); } -bool state_change = true; -while (state_change) +bool continue_tls_process = true; +while (continue_tls_process) {update_time ();dmsg (D_TLS_DEBUG ,"TLS: tls_process: chg=%d ks=%s lame=%s to_link->len=%d wakeup=%d" , - state_change, + continue_tls_process,state_name (ks->state),state_name (ks_lame->state), to_link->len, *wakeup); - state_change =tls_process_state (multi, session, to_link, to_link_addr, - to_link_socket_info, wakeup); + continue_tls_process =tls_process_state (multi, session, to_link, to_link_addr, + to_link_socket_info, wakeup);if (ks->state ==S_ERROR ) {
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/452?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ib6d713f2eb08a4c39d97de3e1a4a832cedc09585
Gerrit-Change-Number: 452
Gerrit-PatchSet: 4
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: newpatchset
cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/452?usp=email )
Change subject: Rename state_change to continue_tls_process
......................................................................
Rename state_change to continue_tls_process
The name state_change is more confusing than helpful as it not really indicates if there was a state change but rather if processing should be continued. There even some states that are definitively state changes (setting to_link buffer) that require continue_tls_process to be set to false.
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg27571.html
---
M src/openvpn/ssl.c
1 file changed, 28 insertions(+), 23 deletions(-)
src/openvpn/ssl.c +28 -23
@@ -2694,7 +2694,7 @@*/ static bool read_incoming_tls_ciphertext (struct buffer *buf,struct key_state *ks, -bool *state_change) +bool *continue_tls_process) {int status =0 ;if (buf->len)
@@ -2714,7 +2714,7 @@if (status ==1 ) {reliable_mark_deleted (ks->rec_reliable, buf); - *state_change = true; + *continue_tls_process = true;dmsg (D_TLS_DEBUG ,"Incoming Ciphertext -> TLS" ); }return true;
@@ -2730,7 +2730,7 @@static bool read_incoming_tls_plaintext (struct key_state *ks,struct buffer *buf, -interval_t *wakeup,bool *state_change) +interval_t *wakeup,bool *continue_tls_process) {ASSERT (buf_init (buf,0 ));
@@ -2744,7 +2744,7 @@ }if (status ==1 ) { - *state_change = true; + *continue_tls_process = true;dmsg (D_TLS_DEBUG ,"TLS -> Incoming Plaintext" );/* More data may be available, wake up again asap to check. */
@@ -2754,7 +2754,7 @@ }static bool -write_outgoing_tls_ciphertext (struct tls_session *session,bool *state_change) +write_outgoing_tls_ciphertext (struct tls_session *session,bool *continue_tls_process) {struct key_state *ks = &session->key[KS_PRIMARY ];
@@ -2830,7 +2830,7 @@reliable_mark_active_outgoing (ks->send_reliable, buf, opcode);INCR_GENERATED ; - *state_change = true; + *continue_tls_process = true; }dmsg (D_TLS_DEBUG ,"Outgoing Ciphertext -> Reliable" ); }
@@ -2839,7 +2839,6 @@return true; } - static bool tls_process_state(struct tls_multi *multi, struct tls_session *session,
@@ -2848,13 +2847,19 @@ struct link_socket_info *to_link_socket_info, interval_t *wakeup) { - bool state_change = false; +/* This variable indicates if we should call this method +* again to process more incoming/outgoing TLS state/data +* We want to repeat this until we either determined that there +* is nothing more to process or that further processing +* should only be done after the outer loop (sending packets etc.) +* has run once more */ +bool continue_tls_process = false;struct key_state *ks = &session->key[KS_PRIMARY ];/* primary key */ /* Initial handshake */ if (ks->state ==S_INITIAL ) { - state_change =session_move_pre_start (session, ks, false); + continue_tls_process =session_move_pre_start (session, ks, false); }/* Are we timed out on receive? */
@@ -2872,7 +2877,7 @@if (ks->state ==S_PRE_START &&reliable_empty (ks->send_reliable)) { ks->state =S_START ; - state_change = true; + continue_tls_process = true;/* New connection, remove any old X509 env variables */ tls_x509_clear_env (session->opt->es);
@@ -2885,7 +2890,7 @@ && reliable_empty(ks->send_reliable)) {session_move_active (multi, session, to_link_socket_info, ks); - state_change = true; + continue_tls_process = true; }/* Reliable buffer to outgoing TCP/UDP (send up to CONTROL_SEND_ACK_MAX ACKs
@@ -2927,7 +2932,7 @@ }else { -if (!read_incoming_tls_ciphertext (&entry->buf, ks, &state_change)) +if (!read_incoming_tls_ciphertext (&entry->buf, ks, &continue_tls_process)) { goto error; }
@@ -2938,7 +2943,7 @@struct buffer *buf = &ks->plaintext_read_buf;if (!buf->len) { -if (!read_incoming_tls_plaintext (ks, buf, wakeup, &state_change)) +if (!read_incoming_tls_plaintext (ks, buf, wakeup, &continue_tls_process)) { goto error; }
@@ -2954,7 +2959,7 @@ goto error; } - state_change = true; + continue_tls_process = true;dmsg (D_TLS_DEBUG_MED ,"STATE S_SENT_KEY" ); ks->state =S_SENT_KEY ; }
@@ -2970,7 +2975,7 @@ goto error; } - state_change = true; + continue_tls_process = true;dmsg (D_TLS_DEBUG_MED ,"STATE S_GOT_KEY" ); ks->state =S_GOT_KEY ; }
@@ -2988,7 +2993,7 @@ }if (status ==1 ) { - state_change = true; + continue_tls_process = true;dmsg (D_TLS_DEBUG ,"Outgoing Plaintext -> TLS" ); } }
@@ -2999,14 +3004,14 @@ buf =reliable_get_buf_output_sequenced (ks->send_reliable);if (buf) { -if (!write_outgoing_tls_ciphertext (session, &state_change)) +if (!write_outgoing_tls_ciphertext (session, &continue_tls_process)) { goto error; } } } -return state_change; +return continue_tls_process; error:tls_clear_error (); ks->state =S_ERROR ;
@@ -3065,19 +3070,19 @@msg (D_TLS_DEBUG_LOW ,"TLS: tls_process: killed expiring key" ); } -bool state_change = true; -while (state_change) +bool continue_tls_process = true; +while (continue_tls_process) {update_time ();dmsg (D_TLS_DEBUG ,"TLS: tls_process: chg=%d ks=%s lame=%s to_link->len=%d wakeup=%d" , - state_change, + continue_tls_process,state_name (ks->state),state_name (ks_lame->state), to_link->len, *wakeup); - state_change =tls_process_state (multi, session, to_link, to_link_addr, - to_link_socket_info, wakeup); + continue_tls_process =tls_process_state (multi, session, to_link, to_link_addr, + to_link_socket_info, wakeup);if (ks->state ==S_ERROR ) {
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/452?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ib6d713f2eb08a4c39d97de3e1a4a832cedc09585
Gerrit-Change-Number: 452
Gerrit-PatchSet: 4
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: merged